// https://www.luogu.com.cn/problem/P1177

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;


pair<int, int> partition(vector<int>& arr, int left, int right) {
    int idx = rand() % (right - left) + left;
    swap(arr[idx], arr[left]);
    const int pivot = arr[left];
    const int start = left;
    int mid = left + 1;
    while (mid <= right) {
        if (arr[mid] < pivot) {
            swap(arr[++left], arr[mid++]);
        } else if (arr[mid] > pivot) {
            swap(arr[mid], arr[right--]);
        } else {
            mid++;
        }
    }

    swap(arr[left], arr[start]);

    return {left, right};
}

void quickSort(vector<int>& arr, int left, int right) {
    if (left < right) {
        pair<int, int> pr = partition(arr, left, right);
        quickSort(arr, left, pr.first - 1);
        quickSort(arr, pr.second + 1, right);
    }
}

int main() {
    int n;
    scanf("%d", &n);
    vector<int> arr(n);
    for (int i=0; i<n; i++) {
        scanf("%d", &arr[i]);
    }

    quickSort(arr, 0, n - 1);

    for (int i=0; i<n; i++) {
        printf("%d ", arr[i]);
    }
    return 0;
}